package com.guoheng.hazard.sys.controller.entpr;

import com.guoheng.hazard.common.base.Result;
import com.guoheng.hazard.sys.mapper.entpr.SpecialOperationMapper;
import com.guoheng.hazard.sys.model.dto.entpr.DealExaminationDTO;
import com.guoheng.hazard.sys.model.dto.entpr.SpecialOperationInsertDTO;
import com.guoheng.hazard.sys.model.dto.entpr.SpecialOperationUpdateDTO;
import com.guoheng.hazard.sys.service.entpr.SpecialOperationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;

/**
 * 类功能描述:　SpecialOperationController
 *
 * @author fbl
 * @date 2019-11-20 17:05
 */
@RestController
@Validated
@Api(value = "特种作业信息")
public class SpecialOperationController {

    @Resource
    SpecialOperationService specialOperationService;

    @ApiOperation(value = "查询特种作业信息")
    @GetMapping(value = "data/basic/enterprise/specials")
    public Result getSpecialOperation(Integer reviewStatus,String entprName, Integer operationType, Long entprId, @RequestParam(value = "pageNum") Integer pageNum, @RequestParam(value = "pageSize") Integer pageSize) {
        return specialOperationService.getSpecialOperation(reviewStatus,entprName, operationType, entprId, pageNum, pageSize);
    }

    @ApiOperation(value = "修改特种作业信息")
    @PutMapping(value = "data/basic/enterprise/special")
    public Result updateSpecialOperation(@RequestBody @Valid SpecialOperationUpdateDTO specialOperationUpdateDTO) {
        return specialOperationService.updateSpecialOperation(specialOperationUpdateDTO);
    }

    @ApiOperation(value = "新增特种作业信息")
    @PostMapping(value = "data/basic/enterprise/special")
    public Result insertSpecialOperation(@RequestBody @Valid SpecialOperationInsertDTO specialOperationInsertDTO) {
        return specialOperationService.insertSpecialOperation(specialOperationInsertDTO);
    }

    @ApiOperation(value = "查询特种作业信息详情")
    @GetMapping(value = "data/basic/enterprise/special/{id}")
    public Result getSpecialOperationById(@PathVariable Long id) {
        return specialOperationService.getSpecialOperationById(id);
    }

    @ApiOperation(value = "处理审核特种作业信息")
    @PutMapping(value = "data/basic/enterprise/dealSpecialOperationExamine/{id}")
    public Result dealSpecialOperationExamine(@PathVariable Long id,@RequestBody DealExaminationDTO dealExaminationDTO) {
        return specialOperationService.dealSpecialOperationExamine(id,dealExaminationDTO);
    }
}